cmake_minimum_required(VERSION 3.0.0)
SET(CMAKE_C_COMPILER ${CC}) 
SET(CMAKE_CXX_COMPILER ${CXX})


project(svlibuv VERSION 0.1.0)
EXECUTE_PROCESS(
    COMMAND git log -1 --format=%H 
    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_VERSION
)

if (NOT DEFINED GIT_VERSION)
    MESSAGE(WARNING "git version = null" ${GIT_VERSION})
    set(GIT_VERSION "cant get git version")
    MESSAGE(STATUS "set git version to " ${GIT_VERSION})
endif()

string(COMPARE EQUAL "${GIT_VERSION}" "" result)
if(result EQUAL 0)
	string(REGEX REPLACE "[\n\t\r]" "" GIT_VERSION ${GIT_VERSION})
else()
	set(GIT_VERSION "cant get git version")
endif()
string(TIMESTAMP COMPILE_TIME "%Y-%m-%d %H:%M:%S")
add_definitions(-DCOMPILE_TIME="${COMPILE_TIME}")
add_definitions(-DGIT_VERSION="${GIT_VERSION}")
add_definitions(-D__USE_POSIX)
add_definitions(-std=c++11)
MESSAGE(STATUS "git version is " ${GIT_VERSION})
MESSAGE(STATUS "compile time is " ${COMPILE_TIME})

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
SET(SCRIPT_PATH ${PROJECT_SOURCE_DIR}/scripts)

INCLUDE_DIRECTORIES(include)
LINK_DIRECTORIES(lib/aarch64)
add_subdirectory(src)
add_subdirectory(test)

MESSAGE(STATUS "This is the binary dir: " ${PROJECT_BINARY_DIR})
MESSAGE(STATUS "This is the source dir: " ${PROJECT_SOURCE_DIR})